home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume10 / logo / part01 next >
Encoding:
Internet Message Format  |  1987-06-23  |  59.6 KB

  1. Path: uunet!rs
  2. From: rs@uunet.UU.NET (Rich Salz)
  3. Newsgroups: comp.sources.unix
  4. Subject: v10i021: Logo interpreter for Unix, Part01/06
  5. Message-ID: <447@uunet.UU.NET>
  6. Date: 24 Jun 87 20:21:29 GMT
  7. Organization: UUNET Communications Services, Arlington, VA
  8. Lines: 2243
  9. Approved: rs@uunet.uu.net
  10.  
  11. Submitted by: Brian Harvey <bh@mit-amt>
  12. Mod.Sources: Volume 10, Number 21
  13. Archive-Name: logo/Part01
  14.  
  15. [  Logo is a a way of life, not just a programming language.  Here's the
  16.    definitive Unix release from one of the primary prophets.  --r$  ]
  17.  
  18. #! /bin/sh
  19. # This is a shell archive.  Remove anything before this line, then unpack
  20. # it by saving it into a file and typing "sh file".  To overwrite existing
  21. # files, type "sh file -c".  You can also feed this as standard input via
  22. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  23. # will see the following message at the end:
  24. #        "End of archive 1 (of 6)."
  25. # Contents:  MANIFEST README adm.i admtek.i atari.i dr11k.c gigi.i
  26. #   helpfile library library/beep.lg library/f.lg library/g.lg
  27. #   library/gigimove.lg library/hanoi.lg library/home.lg
  28. #   library/howis.lg library/l.lg library/laugh.lg library/listp.lg
  29. #   library/pick.lg library/poly.lg library/pos.lg library/quest.lg
  30. #   library/quiz1.lg library/setcursor.lg library/setheight.lg
  31. #   library/setitalic.lg library/setpos.lg library/setsize.lg
  32. #   library/setslant.lg library/setslope.lg library/setx.lg
  33. #   library/sety.lg library/textprint.lg library/top.lg
  34. #   library/towards.lg logohead.c main.c makefile makehelp proplist.c
  35. #   splithelp.c sun.i tek.i unix.c zerr.c
  36. # Wrapped by rsalz@pineapple.bbn.com on Wed Jun 24 14:26:50 1987
  37. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  38. if test -f MANIFEST -a "${1}" != "-c" ; then 
  39.   echo shar: Will not over-write existing file \"MANIFEST\"
  40. else
  41. echo shar: Extracting \"MANIFEST\" \(1926 characters\)
  42. sed "s/^X//" >MANIFEST <<'END_OF_MANIFEST'
  43. X   File Name        Archive #    Description
  44. X-----------------------------------------------------------
  45. X MANIFEST                  1    
  46. X README                    1    
  47. X adm.i                     1    
  48. X admtek.i                  1    
  49. X applediff                 2    
  50. X atari.i                   1    
  51. X dr11k.c                   1    
  52. X gigi.i                    1    
  53. X helpfile                  1    
  54. X library                   1    
  55. X library/beep.lg           1    
  56. X library/f.lg              1    
  57. X library/g.lg              1    
  58. X library/gigimove.lg       1    
  59. X library/hanoi.lg          1    
  60. X library/home.lg           1    
  61. X library/howis.lg          1    
  62. X library/l.lg              1    
  63. X library/laugh.lg          1    
  64. X library/listp.lg          1    
  65. X library/pick.lg           1    
  66. X library/poly.lg           1    
  67. X library/pos.lg            1    
  68. X library/quest.lg          1    
  69. X library/quiz1.lg          1    
  70. X library/setcursor.lg      1    
  71. X library/setheight.lg      1    
  72. X library/setitalic.lg      1    
  73. X library/setpos.lg         1    
  74. X library/setsize.lg        1    
  75. X library/setslant.lg       1    
  76. X library/setslope.lg       1    
  77. X library/setx.lg           1    
  78. X library/sety.lg           1    
  79. X library/textprint.lg      1    
  80. X library/top.lg            1    
  81. X library/towards.lg        1    
  82. X logo.h                    2    
  83. X logo.y                    4    
  84. X logoaux.c                 3    
  85. X logohead.c                1    
  86. X logoman.1                 5    
  87. X logoman.2                 6    
  88. X logonum.c                 2    
  89. X logoop.c                  3    
  90. X logoparse.c               2    
  91. X logoproc.c                3    
  92. X main.c                    1    
  93. X makefile                  1    
  94. X makehelp                  1    
  95. X olddiff                   2    
  96. X procedit.c                2    
  97. X procvars.c                2    
  98. X proplist.c                1    
  99. X splithelp.c               1    
  100. X storage.c                 2    
  101. X sun.i                     1    
  102. X tek.i                     1    
  103. X turtle.c                  3    
  104. X unix.c                    1    
  105. X zerr.c                    1    
  106. END_OF_MANIFEST
  107. if test 1926 -ne `wc -c <MANIFEST`; then
  108.     echo shar: \"MANIFEST\" unpacked with wrong size!
  109. fi
  110. # end of overwriting check
  111. fi
  112. if test -f README -a "${1}" != "-c" ; then 
  113.   echo shar: Will not over-write existing file \"README\"
  114. else
  115. echo shar: Extracting \"README\" \(10027 characters\)
  116. sed "s/^X//" >README <<'END_OF_README'
  117. XUnix Logo Interpreter
  118. X    Brian Harvey
  119. X    Lincoln-Sudbury Regional High School
  120. X
  121. XThis is release 4 of Unix Logo.  It differs from release 3 in that it
  122. Xmore closely follows the syntax of LCSI versions of Logo (Apple Logo,
  123. XIBM Logo, etc.)  In particular, multiple commands on a line are allowed
  124. Xwithout semicolons required between them.  The prompt character is '?'
  125. Xinstead of '*' as before.  The abbreviations 'f', 'l', and 'top' have
  126. Xbeen eliminated.  Positioned text (cleartext and setcursor) are supported
  127. Xusing termlib.  The 'random' primitive now takes an input, like 'rnd',
  128. Xinstead of being equivalent to 'rnd 10' as before.  Error messages are
  129. Xcloser to those in other versions of Logo.  Procedure names can be longer
  130. Xthan 11 characters if your version of Unix has long file names.
  131. X
  132. XThe following obsolete paragraph is included to help users of previous
  133. Xversions understand the version history.
  134. X
  135. X-----
  136. XThis is release 3.2 of Unix Logo.  Release 1 was the one on the first 1982
  137. XUsenix tape.  Release 2 was sent by me (BH) directly to only a few sites.
  138. XThis release is much like release 2 in capabilities and syntax, but has
  139. Xbeen rearranged internally somewhat to make the process of installation
  140. Xon a new system a bit easier.  One major new feature in release 3 is the
  141. Xpause facility, which allows interactive debugging in the local context
  142. Xof an error.  More on this below.  Release 3.1 differs from 3 only in a
  143. Xfew bug fixes and in what is left out under the SMALL option.  Release 3.2
  144. Xdiffers from release 3.1 in bug fixes, better error messages, and one
  145. Xincompatible change: the quotient of two integers can be a non-integer.
  146. X-----
  147. X
  148. XI would like to thank Don Martin and his students at the College of Marin,
  149. Xwho have found huge numbers of obscure bugs in Logo and therefore helped
  150. Xmake this release much more reliable than it would otherwise have been.
  151. X
  152. XLogo is a programming language for education.  It is, I think, unquestionably
  153. Xthe best introductory learning language now available, because it combines
  154. Xthe ease of an interactive language (like BASIC, otherwise terrible) with
  155. Xthe power and structure of a procedural language (like Pascal, not bad once
  156. Xyou get past the details of editing and compiling and loading and semicolons
  157. Xand does var go before or after const).  If you aren't convinced, read the
  158. Xbook "Mindstorms" by Seymour Papert.  It doesn't matter how old your
  159. Xstudents are.
  160. X
  161. XThis directory contains an interpreter for the Logo programming language.
  162. XThe interpreter is written in C and YACC, and runs under Unix(TM) version 7.
  163. XIt has been exported also to Vax 4BSD and to Idris on a PDP-11.  This program
  164. Xis based on a Logo interpreter originally written at the Boston Children's
  165. XMuseum; the present version is very much improved in its capabilities.  On
  166. Xthe other hand, the original version ran in a 64Kb address space; this version
  167. Xrequires split I/D on the PDP-11.  (It can be run on a smaller 11 by turning
  168. Xon the definition of SMALL in logo.h, but with hardly any recursion allowed.
  169. XThis configuration just barely works and is not recommended.  If someone with
  170. Xsuch a system wants to tune it up and send me the results, please do.  SMALL
  171. Xeliminates the pause feature (pause, continue, errpause, etc.) and the
  172. Xproperty list feature (pprop, gprop, etc.) as well as using short ints and
  173. Xfloats instead of long ints and doubles.)
  174. X
  175. XThe file "logoman" in this directory is an nroff-format reference manual. It's
  176. Xvery terse; you should really learn Logo from some other manual and use this
  177. Xone just to learn about idiosyncracies.  There are also two smaller
  178. Xdocumentation files, "applediff" for people accustomed to Apple
  179. XLogo, and "olddiff" for people accustomed to the first LSRHS release.
  180. XIf you are getting this file via Usenet comp.sources.unix, you will
  181. Xhave to do "cat logoman.[12] >logoman" first.
  182. X
  183. XUsers of the first release of LSRHS Logo (the one on the Usenix 82.1 tape)
  184. Xwill find the present version more robust and also more featureful.  Its
  185. Xsyntax is much like that of Apple Logo, which should be helpful to people
  186. Xwith Apples as well as real computers.  Line numbers have been flushed,
  187. Xexcept for use with the go command.  The kludgy re-entrant use of the YACC
  188. Xparser has been eliminated.
  189. X
  190. XThe enclosed makefile should manage to compile this Logo with no errors.
  191. XYou will have to make some modifications for local conditions, most notably
  192. Xin the area of turtle graphics.  Most installation dependencies have been
  193. Xcollected at the beginning of the file logo.h which is included in all
  194. Xcompilations.
  195. X
  196. XTURTLE GRAPHICS.  You must #define symbols in logo.h for the kind(s) of
  197. Xdisplay hardware you support.  Also, if you have a graphics terminal which
  198. Xis not one of the ones already supported in this release, you'll have to
  199. Xadd some code to turtle.c to support it.  The enclosed turtle.c
  200. Xknows about six kinds of graphics hardware:
  201. X    1) Terrapin floor turtles, connected via DR11-K interfaces.
  202. X    2) Atari 800 personal computers, running a special terminal program.
  203. X    3) DEC GIGI graphics terminals.
  204. X    4) Retrographics boards (known to work with ADM-5 terminals,
  205. X        maybe also for other Retrographics products).
  206. X    5) Tektronix 4014 storage tube displays (with severe restrictions
  207. X        because of their inability to erase selectively).
  208. X    6) Sun Microsystems workstations.
  209. XThe files ./*.i contain terminal-specific code which is #included in the
  210. Xcompilation of turtle.c if the corresponding terminal is #defined in logo.h.
  211. XThe code for floor turtles is done very differently and is not separated into
  212. Xa .i file because, alas, it's not so modular.  If you have neither graphics
  213. Xterminals nor floor turtles, you should turn on the NOTURTLE definition in
  214. Xlogo.h to eliminate the turtle primitives.
  215. X
  216. XDEFAULT EDITOR.  The "edit" command in Logo does not use an editor built
  217. Xinto Logo itself.  Instead, it forks and runs your favorite editor in a
  218. Xnew process.  If you have an EDITOR variable in your environment, it uses
  219. Xthat editor (it tries with /bin, /usr/bin, and nothing prepended).  If not,
  220. Xit uses the editor specified in the EDT definition in logo.h.  This is
  221. X"jove" in the version as distributed.
  222. X
  223. XINPUT WAITING TEST.  The "keyp" operation depends on a system call to
  224. Xcheck for characters waiting to be read from the keyboard.  If you are
  225. Xrunning a Berkeley-derived Unix, this will work correctly.  If not, but
  226. Xyou have your own such system call, edit procedure keyp() in logoaux.c
  227. Xto use your own version.
  228. X
  229. XFILENAME FORMAT.  Each Logo procedure is stored in a file called <name>.lg
  230. Xin the current working directory.  Under version 7 Unix, this allows names
  231. Xof procedures to be up to eleven letters long.  VMS filenames can only be
  232. Xnine letters.  The parameter NAMELEN in logo.h should be adjusted.  (Note:
  233. Xdepending on when you got your version of Eunice, it may allow real Unix
  234. Xfilenames, in which case you needn't worry about this.)
  235. X
  236. XTHE PAUSE FEATURE.  You can pause on an error
  237. Xinside a procedure, so you can examine the context interactively.  The
  238. Xpause feature distinguishes SIGINT and SIGQUIT, which were treated identically
  239. Xin earlier releases.  In the normal distribution, SIGQUIT returns to toplevel,
  240. Xwhereas SIGINT causes a pause.  The problem is with Eunice, which doesn't
  241. Xprovide SIGQUIT because VMS doesn't have enough interrupt characters.
  242. XTherefore, the standard distribution allows pausing but not quitting to
  243. Xtoplevel, although you can say "toplevel" while paused.  If you'd rather
  244. Xhave quitting be the default, as in previous releases, interchange the
  245. Xdefinitions of PAUSESIG and OTHERSIG in logo.h; there are also commands
  246. Xto allow the user to make this switch dynamically.
  247. X
  248. X(Eunice users:  Until just recently, an obscure bug in Eunice had the effect
  249. Xthat when you type ^C you don't see a prompt until you hit return.  The switch
  250. Xcalled EUNICE in logo.h enables a workaround for this bug.  Dave Kashtan has
  251. Xnow fixed the underlying problem, but not necessarily in the version you have.
  252. XIf you get too few prompts, turn on the #define EUNICE; if too many prompts,
  253. Xturn it off.)
  254. X
  255. X-----
  256. XINSTALLATION etc.
  257. X
  258. XSaying "make install" after you compile your Logo will install Logo in
  259. X/bin/logo and will also set up two directories:
  260. X    /usr/lib/logo    Library routines written in Logo for general use
  261. X                Also stuff for edit and pots commands.
  262. X    /usr/doc/logo    Excerpts from the manual for the "describe" command
  263. XThe files in these directories are copied, not moved; you can delete the
  264. Xoriginals if you prefer.  See the makefile.  These directories must have
  265. Xthe names shown here, although you can put logo itself somewhere other than
  266. X/bin if you prefer.
  267. X
  268. XThere are three C source files included here which are not part of the Logo
  269. Xinterpreter itself.  One, logohead.c, is used to compile the program
  270. X/usr/lib/logo/logohead which is used for the pots command.  Another,
  271. Xsplithelp.c, is part of the makehelp shell script which is used to generate
  272. Xthe online help messages from the manual.  The third C file,
  273. Xdr11k.c, is a device driver for version 7 for a DEC DR11-K used to interface
  274. XTerrapin floor turtles (you get two per DR11-K) to the PDP-11.  The interface
  275. Xcosts much more than the turtles!
  276. X
  277. XINCOMPATIBILITY WITH RELEASE 2.  (This release is VERY incompatible with
  278. Xrelease 1; see the file olddiff for details.)  To be compatible
  279. Xwith VMS restricted filenames, to run under Eunice, the names of files used
  280. Xto store Logo procedure definitions have been changed from foo.logo to
  281. Xfoo.lg (some installations have a version of release 2 in which the name
  282. Xfoo.log is used, but that looks too much like a log file from a batch job;
  283. Xthe new version seems more Unixy anyway).  If you prefer to keep the old
  284. Xconvention of .logo names, turn on the definition of EXTLOGO in logo.h.
  285. X
  286. XCheck your makefile to be sure it refers to "y.tab.c" and "y.tab.o" on
  287. XUnix, "ytab.c" and "ytab.o" on Eunice.  (Again, some versions of Eunice
  288. Xuse the real Unix filenames.)
  289. X
  290. XIf you have questions about this Logo, try
  291. X    Computer Department
  292. X    Lincoln-Sudbury Regional High School
  293. X    390 Lincoln Road
  294. X    Sudbury, MA  01776
  295. X    617 443-9961
  296. X
  297. END_OF_README
  298. if test 10027 -ne `wc -c <README`; then
  299.     echo shar: \"README\" unpacked with wrong size!
  300. fi
  301. # end of overwriting check
  302. fi
  303. if test -f adm.i -a "${1}" != "-c" ; then 
  304.   echo shar: Will not over-write existing file \"adm.i\"
  305. else
  306. echo shar: Extracting \"adm.i\" \(1444 characters\)
  307. sed "s/^X//" >adm.i <<'END_OF_adm.i'
  308. X/* Include file for turtle.c for ADM with Retrographics board */
  309. X
  310. Xint admturt(),admfrom(),admto(),admstate();
  311. Xstruct display adm ={0.0,0.0,0.0,-512.0,511.0,-390.0,389.0,1.0,0,
  312. X    "","\032\035\033\014\030","","\032\035\033\014\030",
  313. X    admturt,admfrom,admto,nullfn,nullfn,nullfn,
  314. X    nullfn,nullfn,nullfn,admstate};
  315. X
  316. Xadmturt(hide)
  317. Xint hide;    /* nonzero to erase turtle */
  318. X{
  319. X    double newx,newy,angle;
  320. X
  321. X    printf("\035");
  322. X    angle = (mydpy->turth-90.0)*3.141592654/180.0;
  323. X    newx = mydpy->turtx + 15.0*sin(angle);
  324. X    newy = mydpy->turty + 15.0*cos(angle);
  325. X    printf(hide ? "\033\177" : "\033a");
  326. X    plotpos((int)newx,(int)(yscrunch*newy));
  327. X    angle = mydpy->turth*3.141592654/180.0;
  328. X    newx = mydpy->turtx + 15.0*sin(angle);
  329. X    newy = mydpy->turty + 15.0*cos(angle);
  330. X    plotpos((int)newx,(int)(yscrunch*newy));
  331. X    angle = (mydpy->turth+90.0)*3.141592654/180.0;
  332. X    newx = mydpy->turtx + 15.0*sin(angle);
  333. X    newy = mydpy->turty + 15.0*cos(angle);
  334. X    plotpos((int)newx,(int)(yscrunch*newy));
  335. X    angle = (mydpy->turth-90.0)*3.141592654/180.0;
  336. X    newx = mydpy->turtx + 15.0*sin(angle);
  337. X    newy = mydpy->turty + 15.0*cos(angle);
  338. X    plotpos((int)newx,(int)(yscrunch*newy));
  339. X    printf("\037\030");
  340. X}
  341. X
  342. Xadmfrom(x,y)
  343. Xdouble x,y;
  344. X{
  345. X    printf("\035");
  346. X    printf(penerase ? "\033\177" : "\033a");
  347. X    plotpos((int)x,(int)y);
  348. X}
  349. X
  350. Xadmto(x,y)
  351. Xdouble x,y;
  352. X{
  353. X    plotpos((int)x,(int)y);
  354. X    printf("\037\030");
  355. X}
  356. X
  357. Xadmstate(which) {
  358. X    if (which=='R') {
  359. X        printf("ADM can't penreverse, setting pendown.\n");
  360. X        penerase = 0;
  361. X    }
  362. X}
  363. X
  364. END_OF_adm.i
  365. if test 1444 -ne `wc -c <adm.i`; then
  366.     echo shar: \"adm.i\" unpacked with wrong size!
  367. fi
  368. # end of overwriting check
  369. fi
  370. if test -f admtek.i -a "${1}" != "-c" ; then 
  371.   echo shar: Will not over-write existing file \"admtek.i\"
  372. else
  373. echo shar: Extracting \"admtek.i\" \(249 characters\)
  374. sed "s/^X//" >admtek.i <<'END_OF_admtek.i'
  375. X
  376. X/* Include file for turtle.c for both ADM and TEK */
  377. X
  378. Xplotpos(x,y)
  379. Xint x,y;
  380. X{
  381. X    char s[5];
  382. X
  383. X    x += 512;
  384. X    y += 390;
  385. X    s[0] = 040 + ((y>>5)&037);
  386. X    s[1] = 0140 + (y&037);
  387. X    s[2] = 040 + ((x>>5)&037);
  388. X    s[3] = 0100 + (x&037);
  389. X    s[4] = 0;
  390. X    printf("%s",s);
  391. X}
  392. X
  393. END_OF_admtek.i
  394. if test 249 -ne `wc -c <admtek.i`; then
  395.     echo shar: \"admtek.i\" unpacked with wrong size!
  396. fi
  397. # end of overwriting check
  398. fi
  399. if test -f atari.i -a "${1}" != "-c" ; then 
  400.   echo shar: Will not over-write existing file \"atari.i\"
  401. else
  402. echo shar: Extracting \"atari.i\" \(2230 characters\)
  403. sed "s/^X//" >atari.i <<'END_OF_atari.i'
  404. X
  405. X/* Include file for turtle.c for Atari 800 as graphics terminal */
  406. X
  407. Xint ataturn(),apenc(),asetc(),astate();
  408. XNUMBER ncheck();
  409. X
  410. Xstruct display bwatari ={0.0,0.0,0.0,-160.0,160.0,-96.0,96.0,0.875,0,
  411. X    "\033#G","\033c","\033.t","\033.c",
  412. X    nullfn,nullfn,nullfn,nullfn,nullfn,nullfn,ataturn,
  413. X    apenc,asetc,astate};
  414. Xstruct display colatari ={0.0,0.0,0.0,-80.0,80.0,-48.0,48.0,0.875,0,
  415. X    "\033#G","\033c","\033.t","\033.c",
  416. X    nullfn,nullfn,nullfn,nullfn,nullfn,nullfn,ataturn,
  417. X    apenc,asetc,astate};
  418. X
  419. Xataturn() {
  420. X    printf("\033.%dh",(int)((mydpy->turth+11.0)/22.5));
  421. X}
  422. X
  423. Xapenc(ipen)
  424. Xregister int ipen;
  425. X{
  426. X    if ((ipen<0) || (ipen>6)) {
  427. X        puts("Bad pen color, must be 0 to 6.");
  428. X        errhand();
  429. X    }
  430. X    mydpy = (ipen ? &colatari : &bwatari);
  431. X    printf("\033.%dP",ipen);
  432. X    if (!(mydpy->cleared)) {
  433. X        printf("\033.c");    /* clear screen */
  434. X        mydpy->cleared++;
  435. X    }
  436. X
  437. X    /* this is to fix bug in Atari program */
  438. X    printf("\033.%dh",(int)((mydpy->turth+11.0)/22.5));
  439. X}
  440. X
  441. Xasetc(ipen,colorlist)
  442. Xregister int ipen;
  443. Xstruct object *colorlist;
  444. X{
  445. X    register struct object *next;
  446. X    register int icolor,intens;
  447. X    static int normint[] = {1,5,5,1};
  448. X    NUMBER number;
  449. X
  450. X    if ((ipen<0) || (ipen>3)) {
  451. X        puts("Pen number must be 0 to 3.");
  452. X        errhand();
  453. X    }
  454. X
  455. X    if (listp(colorlist)) {
  456. X        number = ncheck(localize(colorlist->obcar));
  457. X        icolor = number;
  458. X        next = colorlist->obcdr;
  459. X        number = ncheck(localize(next->obcar));
  460. X        intens = number;
  461. X        mfree(colorlist);
  462. X    } else {
  463. X        number = ncheck(colorlist);
  464. X        icolor = number;
  465. X        intens = normint[ipen];
  466. X    }
  467. X    if ((icolor<0) || (icolor>15) || (intens<0) || (intens>7)) {
  468. X        puts("Invalid color numbers.");
  469. X        errhand();
  470. X    }
  471. X    printf("\033.%d;%dC",ipen,(icolor*16)+(intens*2));
  472. X}
  473. X
  474. Xastate(which) {
  475. X    switch(which) {
  476. X        case 'c':
  477. X            fflush(stdout);
  478. X            sleep(1);
  479. X        case '*':
  480. X            return;
  481. X        case 'w':
  482. X            fflush(stdout);
  483. X            sleep(1);
  484. X            ataturn();
  485. X            printf("\033.U\033.%d;%dG",
  486. X                (int)(yscrunch*mydpy->turty),(int)(mydpy->turtx));
  487. X            if (pendown)
  488. X                printf("\033.%c","DER"[penerase]);
  489. X            return;
  490. X        case 'G':
  491. X            printf("\033.%d;%dG",
  492. X                (int)(yscrunch*mydpy->turty),(int)(mydpy->turtx));
  493. X            return;
  494. X        case 'R':
  495. X            printf("Atari can't penreverse; setting pendown.\n");
  496. X            penerase = 0;
  497. X            which = 'D';
  498. X            /* falls into */
  499. X        default:
  500. X            printf("\033.%c",which);
  501. X    }
  502. X}
  503. X
  504. END_OF_atari.i
  505. if test 2230 -ne `wc -c <atari.i`; then
  506.     echo shar: \"atari.i\" unpacked with wrong size!
  507. fi
  508. # end of overwriting check
  509. fi
  510. if test -f dr11k.c -a "${1}" != "-c" ; then 
  511.   echo shar: Will not over-write existing file \"dr11k.c\"
  512. else
  513. echo shar: Extracting \"dr11k.c\" \(2022 characters\)
  514. sed "s/^X//" >dr11k.c <<'END_OF_dr11k.c'
  515. X
  516. X/*
  517. X * Driver for Terrapin turtles interfaced via DR11-K.
  518. X * Based on DR-11C driver Copyright (c) 1978, the Children's Museum.
  519. X * This version by Brian Harvey, Lincoln-Sudbury Regional High School.
  520. X */
  521. X
  522. X#include "../h/param.h"
  523. X#include "../h/dir.h"
  524. X#include "../h/user.h"
  525. X
  526. X/* The hardware registers */
  527. Xstruct dr {
  528. X    int drcsr;
  529. X    char dribuf[2];
  530. X    char drobuf[2];
  531. X};
  532. X
  533. X#define NTURTDR 1 /* Number of DR11Ks for turtles (2 turtles per DR) */
  534. X
  535. Xstruct dr *dr_addr[2] = { (struct dr *)0167770, (struct dr *)0167760};
  536. X
  537. Xstruct turt {
  538. X    struct proc *procp;
  539. X    int time;
  540. X    char turnoff;
  541. X} turtle[2*NTURTDR];
  542. X
  543. Xstruct turtcmd {
  544. X    char cmd,bits;
  545. X}  trans[] ={
  546. X    'f', 05,    /* forward */
  547. X    'b',012,    /* back */
  548. X    'l',011,    /* left */
  549. X    'r', 06,    /* right */
  550. X    'P', 0200,    /* pen down */
  551. X    'H', 060,    /* high horn */
  552. X    'L', 040,    /* low horn */
  553. X    'B', 0100,    /* headlights (bright) */
  554. X};
  555. X
  556. X#define NCMDS (sizeof(trans) / sizeof(struct turtcmd))
  557. X
  558. Xturtopen(dev,flag) {
  559. X    dev = minor(dev);
  560. X    if (dev >= 2*NTURTDR) {
  561. X        u.u_error = ENXIO;
  562. X        return;
  563. X    }
  564. X    if (turtle[dev].procp) {
  565. X        u.u_error = EBUSY;
  566. X        return;
  567. X    }
  568. X    turtle[dev].procp = u.u_procp;
  569. X}
  570. X
  571. Xturtclose(dev) {
  572. X    dev = minor(dev);
  573. X    turtle[dev].procp = 0;
  574. X    turtle[dev].time = 0;
  575. X    dr_addr[dev>>1]->drobuf[dev&01] = -1;
  576. X}
  577. X
  578. Xturttimo(dev) {
  579. X    spl5();
  580. X    dr_addr[dev>>1]->drobuf[dev&01] |= turtle[dev].turnoff;
  581. X    turtle[dev].time = 0;
  582. X    wakeup(&turtle[dev]);
  583. X    spl0();
  584. X}
  585. X
  586. Xturtwrite(dev) {
  587. X    register c,i;
  588. X
  589. X    dev = minor(dev);
  590. X    c = cpass();
  591. X    if (c < 0) return;
  592. X    for (i=0; i<NCMDS; i++) {
  593. X        if (c == trans[i].cmd) goto good;
  594. X    }
  595. X    cpass();
  596. X    u.u_error = EIO;
  597. X    return;
  598. Xgood:
  599. X    spl5();
  600. X    if((turtle[dev].time = 2*cpass()) < 0) {    /* BH 8/25/80 2* */
  601. X        turtle[dev].time = 0;
  602. X        spl0();
  603. X        u.u_error = EIO;
  604. X        return;
  605. X    }
  606. X    dr_addr[dev>>1]->drobuf[dev&01] &= ~trans[i].bits;
  607. X    if (turtle[dev].time) {
  608. X        turtle[dev].turnoff = trans[i].bits;
  609. X        timeout(turttimo,dev,turtle[dev].time);
  610. X        while(turtle[dev].time)
  611. X            sleep(&turtle[dev],9);
  612. X    }
  613. X    spl0();
  614. X}
  615. X
  616. Xturtread(dev) {
  617. X    register c;
  618. X
  619. X    dev = minor(dev);
  620. X    c = dr_addr[dev>>1]->dribuf[dev&01];
  621. X    passc(c);
  622. X}
  623. X
  624. END_OF_dr11k.c
  625. if test 2022 -ne `wc -c <dr11k.c`; then
  626.     echo shar: \"dr11k.c\" unpacked with wrong size!
  627. fi
  628. # end of overwriting check
  629. fi
  630. if test -f gigi.i -a "${1}" != "-c" ; then 
  631.   echo shar: Will not over-write existing file \"gigi.i\"
  632. else
  633. echo shar: Extracting \"gigi.i\" \(2132 characters\)
  634. sed "s/^X//" >gigi.i <<'END_OF_gigi.i'
  635. X
  636. X/* Include file for turtle.c for GIGI */
  637. X
  638. Xint gigiturt(),gigifrom(),gigito(),gtcheck(),gpenc(),gstate();
  639. Xstruct display gigi ={0.0,0.0,0.0,-384.0,383.0,-240.0,239.0,0.8,0,
  640. X    "\033PpS(E)P[384,240]\033\\\033PrSM0\033\\\033[20;1H",
  641. X    "\033PrSM2\033\\\033PpS(E)\033\\",
  642. X    "\033PrSM2\033\\\033PpS(E)\033\\",
  643. X    "\033PpS(E)\033\\",
  644. X    gigiturt,gigifrom,gigito,gtcheck,nullfn,nullfn,nullfn,
  645. X    gpenc,nullfn,gstate};
  646. X
  647. Xchar *gigipens[] = {"W(R)","W(E)","W(C)"};
  648. X
  649. Xgtcheck() {
  650. X    if (textmode) {
  651. X        printf("Not in text mode!\n");
  652. X        errhand();
  653. X    }
  654. X}
  655. X
  656. Xgmovepos(x,y)
  657. Xint x,y;
  658. X{
  659. X    char s[5];
  660. X
  661. X    x += 384;
  662. X    y = 240 - y;
  663. X    printf("P[%d,%d]",x,y);
  664. X}
  665. X
  666. Xgplotpos(x,y)
  667. Xint x,y;
  668. X{
  669. X    char s[5];
  670. X
  671. X    x += 384;
  672. X    y = 240 - y;
  673. X    printf("V[%d,%d]",x,y);
  674. X}
  675. X
  676. Xgigifrom(oldx,oldy)
  677. Xdouble oldx,oldy;
  678. X{
  679. X    printf("\033Pp");
  680. X    gmovepos((int)oldx,(int)oldy);
  681. X}
  682. X
  683. Xgigito(newx,newy)
  684. Xdouble newx,newy;
  685. X{
  686. X    printf(gigipens[penerase]);
  687. X    gplotpos((int)newx,(int)newy);
  688. X    printf("\033\\");
  689. X}
  690. X
  691. Xgigiturt()
  692. X{
  693. X    double newx,newy,angle;
  694. X
  695. X    printf("\033PpW(C)");
  696. X    angle = (mydpy->turth-90.0)*3.141592654/180.0;
  697. X    newx = mydpy->turtx + 15.0*sin(angle);
  698. X    newy = mydpy->turty + 15.0*cos(angle);
  699. X    gmovepos((int)newx,(int)(yscrunch*newy));
  700. X    angle = mydpy->turth*3.141592654/180.0;
  701. X    newx = mydpy->turtx + 15.0*sin(angle);
  702. X    newy = mydpy->turty + 15.0*cos(angle);
  703. X    gplotpos((int)newx,(int)(yscrunch*newy));
  704. X    angle = (mydpy->turth+90.0)*3.141592654/180.0;
  705. X    newx = mydpy->turtx + 15.0*sin(angle);
  706. X    newy = mydpy->turty + 15.0*cos(angle);
  707. X    gplotpos((int)newx,(int)(yscrunch*newy));
  708. X    angle = (mydpy->turth-90.0)*3.141592654/180.0;
  709. X    newx = mydpy->turtx + 15.0*sin(angle);
  710. X    newy = mydpy->turty + 15.0*cos(angle);
  711. X    gplotpos((int)newx,(int)(yscrunch*newy));
  712. X    printf(gigipens[penerase]);
  713. X    printf("\033\\");
  714. X}
  715. X
  716. Xgpenc(ipen)
  717. Xregister int ipen;
  718. X{
  719. X    if ((ipen<0) || (ipen>7)) {
  720. X        puts("Bad pen color, must be 0 to 7.");
  721. X        errhand();
  722. X    }
  723. X    printf("\033PpW(I%d)\033\\",ipen);
  724. X}
  725. X
  726. Xgstate(which) {
  727. X    switch (which) {
  728. X        case 't':
  729. X            printf("\033PrSM2\033\\\033PpS(E)\033\\");
  730. X            break;
  731. X        case 's':
  732. X        case 'f':
  733. X            printf("\033PrSM0\033\\\033PpS(E)\033\\");
  734. X            if (textmode && shown) gigiturt();
  735. X            break;
  736. X        case '*':
  737. X            printf("\033[K");
  738. X    }
  739. X}
  740. X
  741. END_OF_gigi.i
  742. if test 2132 -ne `wc -c <gigi.i`; then
  743.     echo shar: \"gigi.i\" unpacked with wrong size!
  744. fi
  745. # end of overwriting check
  746. fi
  747. if test -f helpfile -a "${1}" != "-c" ; then 
  748.   echo shar: Will not over-write existing file \"helpfile\"
  749. else
  750. echo shar: Extracting \"helpfile\" \(398 characters\)
  751. sed "s/^X//" >helpfile <<'END_OF_helpfile'
  752. X
  753. XLogo is an interactive procedural programming language designed for
  754. Xeducation.  The file
  755. X    /usr/src/cmd/logo/logoman
  756. Xis an nroff-format logo manual.  To find out about a particular Logo
  757. Xprimitive, use the "describe" command with the name of the primitive as
  758. Xits input, e.g.
  759. X    describe "print
  760. Xto see the description of the print command.
  761. X
  762. XThe command to leave Logo is "goodbye" (abbreviated "bye").
  763. X
  764. END_OF_helpfile
  765. if test 398 -ne `wc -c <helpfile`; then
  766.     echo shar: \"helpfile\" unpacked with wrong size!
  767. fi
  768. # end of overwriting check
  769. fi
  770. if test ! -d library ; then
  771.     echo shar: Creating directory \"library\"
  772.     mkdir library
  773. fi
  774. if test -f library/beep.lg -a "${1}" != "-c" ; then 
  775.   echo shar: Will not over-write existing file \"library/beep.lg\"
  776. else
  777. echo shar: Extracting \"library/beep.lg\" \(27 characters\)
  778. sed "s/^X//" >library/beep.lg <<'END_OF_library/beep.lg'
  779. X
  780. Xto beep :n
  781. Xhitoot :n
  782. Xend
  783. X
  784. END_OF_library/beep.lg
  785. if test 27 -ne `wc -c <library/beep.lg`; then
  786.     echo shar: \"library/beep.lg\" unpacked with wrong size!
  787. fi
  788. # end of overwriting check
  789. fi
  790. if test -f library/f.lg -a "${1}" != "-c" ; then 
  791.   echo shar: Will not over-write existing file \"library/f.lg\"
  792. else
  793. echo shar: Extracting \"library/f.lg\" \(38 characters\)
  794. sed "s/^X//" >library/f.lg <<'END_OF_library/f.lg'
  795. X
  796. Xto f :thing
  797. Xoutput first :thing
  798. Xend
  799. X
  800. END_OF_library/f.lg
  801. if test 38 -ne `wc -c <library/f.lg`; then
  802.     echo shar: \"library/f.lg\" unpacked with wrong size!
  803. fi
  804. # end of overwriting check
  805. fi
  806. if test -f library/g.lg -a "${1}" != "-c" ; then 
  807.   echo shar: Will not over-write existing file \"library/g.lg\"
  808. else
  809. echo shar: Extracting \"library/g.lg\" \(70 characters\)
  810. sed "s/^X//" >library/g.lg <<'END_OF_library/g.lg'
  811. X
  812. Xto g
  813. Xpr [The abbreviation for 'goodbye' is now 'bye', not 'g'.]
  814. Xend
  815. X
  816. END_OF_library/g.lg
  817. if test 70 -ne `wc -c <library/g.lg`; then
  818.     echo shar: \"library/g.lg\" unpacked with wrong size!
  819. fi
  820. # end of overwriting check
  821. fi
  822. if test -f library/gigimove.lg -a "${1}" != "-c" ; then 
  823.   echo shar: Will not over-write existing file \"library/gigimove.lg\"
  824. else
  825. echo shar: Extracting \"library/gigimove.lg\" \(151 characters\)
  826. sed "s/^X//" >library/gigimove.lg <<'END_OF_library/gigimove.lg'
  827. X
  828. XREPLACE THE TWO-CHAR SEQUENCE ^[ WITH AN ESCAPE, TWICE IN THIS FILE
  829. Xto gigimove :x :y
  830. Xtype "^[PpP\[
  831. Xtype :x+384
  832. Xtype ",
  833. Xtype 240-:y
  834. Xtype "\]^[\\
  835. Xend
  836. X
  837. END_OF_library/gigimove.lg
  838. if test 151 -ne `wc -c <library/gigimove.lg`; then
  839.     echo shar: \"library/gigimove.lg\" unpacked with wrong size!
  840. fi
  841. # end of overwriting check
  842. fi
  843. if test -f library/hanoi.lg -a "${1}" != "-c" ; then 
  844.   echo shar: Will not over-write existing file \"library/hanoi.lg\"
  845. else
  846. echo shar: Extracting \"library/hanoi.lg\" \(190 characters\)
  847. sed "s/^X//" >library/hanoi.lg <<'END_OF_library/hanoi.lg'
  848. X
  849. Xto hanoi :number :from :to :other
  850. Xif equalp :number 0 [stop]
  851. Xhanoi :number-1 :from :other :to
  852. Xprint {sentence [Move disk] :number "from :from "to :to}
  853. Xhanoi :number-1 :other :to :from
  854. Xend
  855. X
  856. END_OF_library/hanoi.lg
  857. if test 190 -ne `wc -c <library/hanoi.lg`; then
  858.     echo shar: \"library/hanoi.lg\" unpacked with wrong size!
  859. fi
  860. # end of overwriting check
  861. fi
  862. if test -f library/home.lg -a "${1}" != "-c" ; then 
  863.   echo shar: Will not over-write existing file \"library/home.lg\"
  864. else
  865. echo shar: Extracting \"library/home.lg\" \(31 characters\)
  866. sed "s/^X//" >library/home.lg <<'END_OF_library/home.lg'
  867. X
  868. Xto home
  869. Xsetxy 0 0
  870. Xseth 0
  871. Xend
  872. X
  873. END_OF_library/home.lg
  874. if test 31 -ne `wc -c <library/home.lg`; then
  875.     echo shar: \"library/home.lg\" unpacked with wrong size!
  876. fi
  877. # end of overwriting check
  878. fi
  879. if test -f library/howis.lg -a "${1}" != "-c" ; then 
  880.   echo shar: Will not over-write existing file \"library/howis.lg\"
  881. else
  882. echo shar: Extracting \"library/howis.lg\" \(135 characters\)
  883. sed "s/^X//" >library/howis.lg <<'END_OF_library/howis.lg'
  884. X
  885. Xto howis :whatever
  886. Xif equalp first :whatever "w output "wonderful
  887. Xif equalp first :whatever "t output "terrific
  888. Xoutput "ordinary
  889. Xend
  890. X
  891. END_OF_library/howis.lg
  892. if test 135 -ne `wc -c <library/howis.lg`; then
  893.     echo shar: \"library/howis.lg\" unpacked with wrong size!
  894. fi
  895. # end of overwriting check
  896. fi
  897. if test -f library/l.lg -a "${1}" != "-c" ; then 
  898.   echo shar: Will not over-write existing file \"library/l.lg\"
  899. else
  900. echo shar: Extracting \"library/l.lg\" \(37 characters\)
  901. sed "s/^X//" >library/l.lg <<'END_OF_library/l.lg'
  902. X
  903. Xto l :thing
  904. Xoutput last :thing
  905. Xend
  906. X
  907. END_OF_library/l.lg
  908. if test 37 -ne `wc -c <library/l.lg`; then
  909.     echo shar: \"library/l.lg\" unpacked with wrong size!
  910. fi
  911. # end of overwriting check
  912. fi
  913. if test -f library/laugh.lg -a "${1}" != "-c" ; then 
  914.   echo shar: Will not over-write existing file \"library/laugh.lg\"
  915. else
  916. echo shar: Extracting \"library/laugh.lg\" \(47 characters\)
  917. sed "s/^X//" >library/laugh.lg <<'END_OF_library/laugh.lg'
  918. X
  919. Xto laugh
  920. Xpr "ha
  921. Xpr [ha ha]
  922. Xpr [ha ha ha]
  923. Xend
  924. X
  925. END_OF_library/laugh.lg
  926. if test 47 -ne `wc -c <library/laugh.lg`; then
  927.     echo shar: \"library/laugh.lg\" unpacked with wrong size!
  928. fi
  929. # end of overwriting check
  930. fi
  931. if test -f library/listp.lg -a "${1}" != "-c" ; then 
  932.   echo shar: Will not over-write existing file \"library/listp.lg\"
  933. else
  934. echo shar: Extracting \"library/listp.lg\" \(58 characters\)
  935. sed "s/^X//" >library/listp.lg <<'END_OF_library/listp.lg'
  936. X
  937. Xto listp :listpobject
  938. Xoutput not wordp :listpobject
  939. Xend
  940. X
  941. END_OF_library/listp.lg
  942. if test 58 -ne `wc -c <library/listp.lg`; then
  943.     echo shar: \"library/listp.lg\" unpacked with wrong size!
  944. fi
  945. # end of overwriting check
  946. fi
  947. if test -f library/pick.lg -a "${1}" != "-c" ; then 
  948.   echo shar: Will not over-write existing file \"library/pick.lg\"
  949. else
  950. echo shar: Extracting \"library/pick.lg\" \(55 characters\)
  951. sed "s/^X//" >library/pick.lg <<'END_OF_library/pick.lg'
  952. X
  953. Xto pick :list
  954. Xoutput nth 1+rnd count :list :list
  955. Xend
  956. X
  957. END_OF_library/pick.lg
  958. if test 55 -ne `wc -c <library/pick.lg`; then
  959.     echo shar: \"library/pick.lg\" unpacked with wrong size!
  960. fi
  961. # end of overwriting check
  962. fi
  963. if test -f library/poly.lg -a "${1}" != "-c" ; then 
  964.   echo shar: Will not over-write existing file \"library/poly.lg\"
  965. else
  966. echo shar: Extracting \"library/poly.lg\" \(87 characters\)
  967. sed "s/^X//" >library/poly.lg <<'END_OF_library/poly.lg'
  968. X
  969. Xto poly :side :ang :num
  970. Xif :num=0 [stop]
  971. Xfd :side
  972. Xrt :ang
  973. Xpoly :side :ang :num-1
  974. Xend
  975. X
  976. END_OF_library/poly.lg
  977. if test 87 -ne `wc -c <library/poly.lg`; then
  978.     echo shar: \"library/poly.lg\" unpacked with wrong size!
  979. fi
  980. # end of overwriting check
  981. fi
  982. if test -f library/pos.lg -a "${1}" != "-c" ; then 
  983.   echo shar: Will not over-write existing file \"library/pos.lg\"
  984. else
  985. echo shar: Extracting \"library/pos.lg\" \(35 characters\)
  986. sed "s/^X//" >library/pos.lg <<'END_OF_library/pos.lg'
  987. X
  988. Xto pos
  989. Xoutput list xcor ycor
  990. Xend
  991. X
  992. END_OF_library/pos.lg
  993. if test 35 -ne `wc -c <library/pos.lg`; then
  994.     echo shar: \"library/pos.lg\" unpacked with wrong size!
  995. fi
  996. # end of overwriting check
  997. fi
  998. if test -f library/quest.lg -a "${1}" != "-c" ; then 
  999.   echo shar: Will not over-write existing file \"library/quest.lg\"
  1000. else
  1001. echo shar: Extracting \"library/quest.lg\" \(146 characters\)
  1002. sed "s/^X//" >library/quest.lg <<'END_OF_library/quest.lg'
  1003. X
  1004. Xto quest :question :answer
  1005. Xtype :question
  1006. Xif equalp request :answer [print [You're right!] ; stop]
  1007. Xprint sentence [No, silly, it's] :answer
  1008. Xend
  1009. X
  1010. END_OF_library/quest.lg
  1011. if test 146 -ne `wc -c <library/quest.lg`; then
  1012.     echo shar: \"library/quest.lg\" unpacked with wrong size!
  1013. fi
  1014. # end of overwriting check
  1015. fi
  1016. if test -f library/quiz1.lg -a "${1}" != "-c" ; then 
  1017.   echo shar: Will not over-write existing file \"library/quiz1.lg\"
  1018. else
  1019. echo shar: Extracting \"library/quiz1.lg\" \(163 characters\)
  1020. sed "s/^X//" >library/quiz1.lg <<'END_OF_library/quiz1.lg'
  1021. X
  1022. Xto quiz1
  1023. Xtype [Who is the greatest musician of all time]
  1024. Xif equalp request [John Lennon] [print [You're right!] ; stop]
  1025. Xprint [No, silly, it's John Lennon!]
  1026. Xend
  1027. X
  1028. END_OF_library/quiz1.lg
  1029. if test 163 -ne `wc -c <library/quiz1.lg`; then
  1030.     echo shar: \"library/quiz1.lg\" unpacked with wrong size!
  1031. fi
  1032. # end of overwriting check
  1033. fi
  1034. if test -f library/setcursor.lg -a "${1}" != "-c" ; then 
  1035.   echo shar: Will not over-write existing file \"library/setcursor.lg\"
  1036. else
  1037. echo shar: Extracting \"library/setcursor.lg\" \(63 characters\)
  1038. sed "s/^X//" >library/setcursor.lg <<'END_OF_library/setcursor.lg'
  1039. X
  1040. Xto setcursor :place
  1041. Xsetcursorxy first :place last :place
  1042. Xend
  1043. X
  1044. END_OF_library/setcursor.lg
  1045. if test 63 -ne `wc -c <library/setcursor.lg`; then
  1046.     echo shar: \"library/setcursor.lg\" unpacked with wrong size!
  1047. fi
  1048. # end of overwriting check
  1049. fi
  1050. if test -f library/setheight.lg -a "${1}" != "-c" ; then 
  1051.   echo shar: Will not over-write existing file \"library/setheight.lg\"
  1052. else
  1053. echo shar: Extracting \"library/setheight.lg\" \(56 characters\)
  1054. sed "s/^X//" >library/setheight.lg <<'END_OF_library/setheight.lg'
  1055. X
  1056. Xto setheight :height
  1057. Xmake "gigitextheight :height
  1058. Xend
  1059. X
  1060. END_OF_library/setheight.lg
  1061. if test 56 -ne `wc -c <library/setheight.lg`; then
  1062.     echo shar: \"library/setheight.lg\" unpacked with wrong size!
  1063. fi
  1064. # end of overwriting check
  1065. fi
  1066. if test -f library/setitalic.lg -a "${1}" != "-c" ; then 
  1067.   echo shar: Will not over-write existing file \"library/setitalic.lg\"
  1068. else
  1069. echo shar: Extracting \"library/setitalic.lg\" \(54 characters\)
  1070. sed "s/^X//" >library/setitalic.lg <<'END_OF_library/setitalic.lg'
  1071. X
  1072. Xto setitalic :slant
  1073. Xmake "gigitextitalic :slant
  1074. Xend
  1075. X
  1076. END_OF_library/setitalic.lg
  1077. if test 54 -ne `wc -c <library/setitalic.lg`; then
  1078.     echo shar: \"library/setitalic.lg\" unpacked with wrong size!
  1079. fi
  1080. # end of overwriting check
  1081. fi
  1082. if test -f library/setpos.lg -a "${1}" != "-c" ; then 
  1083.   echo shar: Will not over-write existing file \"library/setpos.lg\"
  1084. else
  1085. echo shar: Extracting \"library/setpos.lg\" \(72 characters\)
  1086. sed "s/^X//" >library/setpos.lg <<'END_OF_library/setpos.lg'
  1087. X
  1088. Xto setpos :setposplace
  1089. Xsetxy first :setposplace last :setposplace
  1090. Xend
  1091. X
  1092. END_OF_library/setpos.lg
  1093. if test 72 -ne `wc -c <library/setpos.lg`; then
  1094.     echo shar: \"library/setpos.lg\" unpacked with wrong size!
  1095. fi
  1096. # end of overwriting check
  1097. fi
  1098. if test -f library/setsize.lg -a "${1}" != "-c" ; then 
  1099.   echo shar: Will not over-write existing file \"library/setsize.lg\"
  1100. else
  1101. echo shar: Extracting \"library/setsize.lg\" \(48 characters\)
  1102. sed "s/^X//" >library/setsize.lg <<'END_OF_library/setsize.lg'
  1103. X
  1104. Xto setsize :size
  1105. Xmake "gigitextsize :size
  1106. Xend
  1107. X
  1108. END_OF_library/setsize.lg
  1109. if test 48 -ne `wc -c <library/setsize.lg`; then
  1110.     echo shar: \"library/setsize.lg\" unpacked with wrong size!
  1111. fi
  1112. # end of overwriting check
  1113. fi
  1114. if test -f library/setslant.lg -a "${1}" != "-c" ; then 
  1115.   echo shar: Will not over-write existing file \"library/setslant.lg\"
  1116. else
  1117. echo shar: Extracting \"library/setslant.lg\" \(55 characters\)
  1118. sed "s/^X//" >library/setslant.lg <<'END_OF_library/setslant.lg'
  1119. X
  1120. Xto setslant :slant
  1121. Xmake "gigitextslant 45*:slant
  1122. Xend
  1123. X
  1124. END_OF_library/setslant.lg
  1125. if test 55 -ne `wc -c <library/setslant.lg`; then
  1126.     echo shar: \"library/setslant.lg\" unpacked with wrong size!
  1127. fi
  1128. # end of overwriting check
  1129. fi
  1130. if test -f library/setslope.lg -a "${1}" != "-c" ; then 
  1131.   echo shar: Will not over-write existing file \"library/setslope.lg\"
  1132. else
  1133. echo shar: Extracting \"library/setslope.lg\" \(55 characters\)
  1134. sed "s/^X//" >library/setslope.lg <<'END_OF_library/setslope.lg'
  1135. X
  1136. Xto setslope :slope
  1137. Xmake "gigitextslope 45*:slope
  1138. Xend
  1139. X
  1140. END_OF_library/setslope.lg
  1141. if test 55 -ne `wc -c <library/setslope.lg`; then
  1142.     echo shar: \"library/setslope.lg\" unpacked with wrong size!
  1143. fi
  1144. # end of overwriting check
  1145. fi
  1146. if test -f library/setx.lg -a "${1}" != "-c" ; then 
  1147.   echo shar: Will not over-write existing file \"library/setx.lg\"
  1148. else
  1149. echo shar: Extracting \"library/setx.lg\" \(47 characters\)
  1150. sed "s/^X//" >library/setx.lg <<'END_OF_library/setx.lg'
  1151. X
  1152. Xto setx :setxcoord
  1153. Xsetxy :setxcoord ycor
  1154. Xend
  1155. X
  1156. END_OF_library/setx.lg
  1157. if test 47 -ne `wc -c <library/setx.lg`; then
  1158.     echo shar: \"library/setx.lg\" unpacked with wrong size!
  1159. fi
  1160. # end of overwriting check
  1161. fi
  1162. if test -f library/sety.lg -a "${1}" != "-c" ; then 
  1163.   echo shar: Will not over-write existing file \"library/sety.lg\"
  1164. else
  1165. echo shar: Extracting \"library/sety.lg\" \(47 characters\)
  1166. sed "s/^X//" >library/sety.lg <<'END_OF_library/sety.lg'
  1167. X
  1168. Xto sety :setycoord
  1169. Xsetxy xcor :setycoord
  1170. Xend
  1171. X
  1172. END_OF_library/sety.lg
  1173. if test 47 -ne `wc -c <library/sety.lg`; then
  1174.     echo shar: \"library/sety.lg\" unpacked with wrong size!
  1175. fi
  1176. # end of overwriting check
  1177. fi
  1178. if test -f library/textprint.lg -a "${1}" != "-c" ; then 
  1179.   echo shar: Will not over-write existing file \"library/textprint.lg\"
  1180. else
  1181. echo shar: Extracting \"library/textprint.lg\" \(442 characters\)
  1182. sed "s/^X//" >library/textprint.lg <<'END_OF_library/textprint.lg'
  1183. X
  1184. XREPLACE THE TWO-CHAR SEQUENCE ^[ WITH AN ESCAPE, TWICE IN THIS FILE
  1185. Xto textprint :text
  1186. Xgigimove xcor ycor
  1187. Xtype "^[PpT\(B
  1188. Xif namep "gigitextslope [type "D; type :gigitextslope]
  1189. Xif namep "gigitextsize [type "S; type :gigitextsize]
  1190. Xif namep "gigitextslant [type "D; type :gigitextslant]
  1191. Xif namep "gigitextheight [type "H; type :gigitextheight]
  1192. Xif namep "gigitextitalic [type "I; type :gigitextitalic]
  1193. Xtype "\)'
  1194. Xtype :text
  1195. Xtype "'\(E\)^[\\
  1196. Xend
  1197. X
  1198. END_OF_library/textprint.lg
  1199. if test 442 -ne `wc -c <library/textprint.lg`; then
  1200.     echo shar: \"library/textprint.lg\" unpacked with wrong size!
  1201. fi
  1202. # end of overwriting check
  1203. fi
  1204. if test -f library/top.lg -a "${1}" != "-c" ; then 
  1205.   echo shar: Will not over-write existing file \"library/top.lg\"
  1206. else
  1207. echo shar: Extracting \"library/top.lg\" \(22 characters\)
  1208. sed "s/^X//" >library/top.lg <<'END_OF_library/top.lg'
  1209. X
  1210. Xto top
  1211. Xtoplevel
  1212. Xend
  1213. X
  1214. END_OF_library/top.lg
  1215. if test 22 -ne `wc -c <library/top.lg`; then
  1216.     echo shar: \"library/top.lg\" unpacked with wrong size!
  1217. fi
  1218. # end of overwriting check
  1219. fi
  1220. if test -f library/towards.lg -a "${1}" != "-c" ; then 
  1221.   echo shar: Will not over-write existing file \"library/towards.lg\"
  1222. else
  1223. echo shar: Extracting \"library/towards.lg\" \(60 characters\)
  1224. sed "s/^X//" >library/towards.lg <<'END_OF_library/towards.lg'
  1225. X
  1226. Xto towards :pos
  1227. Xoutput towardsxy first :pos last :pos
  1228. Xend
  1229. X
  1230. END_OF_library/towards.lg
  1231. if test 60 -ne `wc -c <library/towards.lg`; then
  1232.     echo shar: \"library/towards.lg\" unpacked with wrong size!
  1233. fi
  1234. # end of overwriting check
  1235. fi
  1236. if test -f logohead.c -a "${1}" != "-c" ; then 
  1237.   echo shar: Will not over-write existing file \"logohead.c\"
  1238. else
  1239. echo shar: Extracting \"logohead.c\" \(310 characters\)
  1240. sed "s/^X//" >logohead.c <<'END_OF_logohead.c'
  1241. X
  1242. X/* Print the first line of selected files.  Used by Logo pots command. */
  1243. X
  1244. X#include <stdio.h>
  1245. X
  1246. Xmain(argc,argv)
  1247. Xint argc;
  1248. Xchar **argv;
  1249. X{
  1250. X    FILE *fp;
  1251. X    char line[100];
  1252. X
  1253. X    while (--argc > 0) {
  1254. X        if ((fp = fopen(argv[1],"r")) != NULL) {
  1255. X            fgets(line,100,fp);
  1256. X            printf("%s",line);
  1257. X            fclose(fp);
  1258. X        }
  1259. X    argv++;
  1260. X    }
  1261. X}
  1262. X
  1263. END_OF_logohead.c
  1264. if test 310 -ne `wc -c <logohead.c`; then
  1265.     echo shar: \"logohead.c\" unpacked with wrong size!
  1266. fi
  1267. # end of overwriting check
  1268. fi
  1269. if test -f main.c -a "${1}" != "-c" ; then 
  1270.   echo shar: Will not over-write existing file \"main.c\"
  1271. else
  1272. echo shar: Extracting \"main.c\" \(1080 characters\)
  1273. sed "s/^X//" >main.c <<'END_OF_main.c'
  1274. X
  1275. X/*  This provides the outermost framework of LOGO, calling the parser to
  1276. X *    begin with, and then thereafter whenever an interrupt or error occurs.
  1277. X *    Copyright (C) 1979, The Children's Museum, Boston, Mass.
  1278. X *    Written by Douglas B. Klunder.
  1279. X */
  1280. X
  1281. X#include "logo.h"
  1282. X
  1283. Xchar editfile[30];
  1284. Xextern char *getbpt;
  1285. X#ifndef NOTURTLE
  1286. Xextern int turtdes;
  1287. Xextern struct display *mydpy;
  1288. X#endif
  1289. X#ifdef SETCURSOR
  1290. X#include <sgtty.h>
  1291. Xstruct sgttyb tty;
  1292. X#endif
  1293. X
  1294. Xmain(argc,argv)
  1295. Xint argc;
  1296. Xchar *argv[];
  1297. X{
  1298. X    int i[2];
  1299. X    char tbuff[BUFSIZ];
  1300. X
  1301. X    setbuf(stdout,tbuff);
  1302. X    time(i);
  1303. X    SRAND(i[1]+i[0]);
  1304. X    sprintf(editfile,"/tmp/logo%u",(short)getpid());
  1305. X#ifdef SETCURSOR
  1306. X    gtty(1,&tty);
  1307. X#endif
  1308. X    if (argc>1)
  1309. X        getbpt = argv[1];
  1310. X    else
  1311. X        printf("\nWelcome to Children's Museum/LSRHS LOGO\n?");
  1312. X    fflush(stdout);
  1313. X    while (enter()==1) {
  1314. X        yyprompt(1);
  1315. X    }
  1316. X    cboff();
  1317. X#ifdef SETCURSOR
  1318. X    stty(1,&tty);
  1319. X#endif
  1320. X#ifndef NOTURTLE
  1321. X#ifdef FLOOR
  1322. X    if (turtdes>0)
  1323. X        printf("Please\007 unplug the turtle\007 and put it\007 away.\n");
  1324. X#endif
  1325. X    if (turtdes<0) {
  1326. X        printf(mydpy->finish);
  1327. X        (*mydpy->outfn)();
  1328. X    }
  1329. X#endif
  1330. X    unlink(editfile);
  1331. X}
  1332. X
  1333. END_OF_main.c
  1334. if test 1080 -ne `wc -c <main.c`; then
  1335.     echo shar: \"main.c\" unpacked with wrong size!
  1336. fi
  1337. # end of overwriting check
  1338. fi
  1339. if test -f makefile -a "${1}" != "-c" ; then 
  1340.   echo shar: Will not over-write existing file \"makefile\"
  1341. else
  1342. echo shar: Extracting \"makefile\" \(717 characters\)
  1343. sed "s/^X//" >makefile <<'END_OF_makefile'
  1344. X
  1345. Xall:    logo logohead
  1346. X
  1347. Xlogo:    y.tab.o logoparse.o zerr.o main.o logoop.o logoaux.o unix.o \
  1348. Xstorage.o turtle.o procedit.o logonum.o procvars.o logoproc.o proplist.o
  1349. X    ld -X -i -o logo /lib/crt0.o *.o -lm -lc -ltermlib
  1350. X
  1351. Xy.tab.c:    logo.y
  1352. X    yacc logo.y
  1353. X
  1354. Xturtle.c:    atari.i gigi.i adm.i tek.i admtek.i sun.i
  1355. X    touch turtle.c
  1356. X
  1357. Xlogohead:    logohead.c
  1358. X    cc -O -o logohead logohead.c
  1359. X
  1360. Xhelp:    splithelp logoman
  1361. X    ./makehelp
  1362. X
  1363. Xsplithelp:    splithelp.c
  1364. X    cc -O -o splithelp splithelp.c
  1365. X
  1366. X.c.o:    ;cc -O -c $*.c
  1367. X
  1368. Xinstall:
  1369. X    cp logo /bin/logo
  1370. X    mkdir /usr/doc/logo
  1371. X    cp help/* /usr/doc/logo
  1372. X    cp helpfile applediff olddiff /usr/doc/logo
  1373. X    mkdir /usr/lib/logo
  1374. X    cp library/* /usr/lib/logo
  1375. X    cp logohead /usr/lib/logo
  1376. X
  1377. Xclean:
  1378. X    rm *.o logo logohead splithelp
  1379. X
  1380. END_OF_makefile
  1381. if test 717 -ne `wc -c <makefile`; then
  1382.     echo shar: \"makefile\" unpacked with wrong size!
  1383. fi
  1384. # end of overwriting check
  1385. fi
  1386. if test -f makehelp -a "${1}" != "-c" ; then 
  1387.   echo shar: Will not over-write existing file \"makehelp\"
  1388. else
  1389. echo shar: Extracting \"makehelp\" \(35 characters\)
  1390. sed "s/^X//" >makehelp <<'END_OF_makehelp'
  1391. Xed - logoman << 'foo'
  1392. X1i
  1393. X.pl 999i
  1394. X
  1395. END_OF_makehelp
  1396. if test 35 -ne `wc -c <makehelp`; then
  1397.     echo shar: \"makehelp\" unpacked with wrong size!
  1398. fi
  1399. # end of overwriting check
  1400. fi
  1401. if test -f proplist.c -a "${1}" != "-c" ; then 
  1402.   echo shar: Will not over-write existing file \"proplist.c\"
  1403. else
  1404. echo shar: Extracting \"proplist.c\" \(3698 characters\)
  1405. sed "s/^X//" >proplist.c <<'END_OF_proplist.c'
  1406. X
  1407. X/* Property list primitives */
  1408. X
  1409. X#include "logo.h"
  1410. X
  1411. X#ifndef SMALL
  1412. X
  1413. Xstruct property {
  1414. X    char *prname;
  1415. X    struct object *prvalue;
  1416. X    struct property *prnext;
  1417. X};
  1418. X
  1419. Xstruct proplist {
  1420. X    char *plname;
  1421. X    struct property *props;
  1422. X    struct proplist *plnext;
  1423. X} *allprops = NULL;
  1424. X
  1425. Xstruct proplist *findplist(var)
  1426. Xchar *var;
  1427. X{
  1428. X    register struct proplist *plp;
  1429. X
  1430. X    for (plp=allprops; plp; plp=plp->plnext)
  1431. X        if (!strcmp(var,plp->plname)) return(plp);
  1432. X    return(0);
  1433. X}
  1434. X
  1435. Xstruct property *findprop(prp,name)
  1436. Xregister struct property *prp;
  1437. Xchar *name;
  1438. X{
  1439. X    for (; prp; prp=prp->prnext)
  1440. X        if (!strcmp(name,prp->prname)) return(prp);
  1441. X    return(0);
  1442. X}
  1443. X
  1444. Xpprop(name,prop,object)
  1445. Xstruct object *name,*prop,*object;
  1446. X{
  1447. X    char *nstr;
  1448. X    register struct proplist *plp;
  1449. X    register struct property *prp,*prp1;
  1450. X
  1451. X    if (!stringp(name)) ungood("Pprop",name);
  1452. X    if (!stringp(prop)) ungood("Pprop",prop);
  1453. X    if ((plp=findplist(token(name->obstr)))==0) {
  1454. X        plp=(struct proplist *)ckmalloc(sizeof(struct proplist));
  1455. X        nstr = ckmalloc(1+strlen(name->obstr));
  1456. X        strcpy(nstr,token(name->obstr));
  1457. X        plp->plname = nstr;
  1458. X        plp->props = 0;
  1459. X        plp->plnext = allprops;
  1460. X        allprops = plp;
  1461. X    }
  1462. X    prp = plp->props;
  1463. X    if (prp1 = findprop(prp,prop->obstr)) {
  1464. X        lfree(prp1->prvalue);
  1465. X    } else {
  1466. X        prp1 = (struct property *)ckmalloc(sizeof(struct property));
  1467. X        nstr = ckmalloc(1+strlen(prop->obstr));
  1468. X        strcpy(nstr,token(prop->obstr));
  1469. X        prp1->prname = nstr;
  1470. X        prp1->prnext = prp;
  1471. X        plp->props = prp1;
  1472. X    }
  1473. X    prp1->prvalue = globcopy(object);
  1474. X    mfree(name);
  1475. X    mfree(prop);
  1476. X    mfree(object);
  1477. X}
  1478. X
  1479. Xremprop(name,prop)
  1480. Xstruct object *name,*prop;
  1481. X{
  1482. X    register struct proplist *plp;
  1483. X    register struct property *prp,*prp1;
  1484. X
  1485. X    if (!stringp(name)) ungood("Remprop",name);
  1486. X    if (!stringp(prop)) ungood("Remprop",prop);
  1487. X    if ((plp=findplist(token(name->obstr)))==0) {
  1488. X        pf1("%p has no properties\n",name);
  1489. X        errhand();
  1490. X    }
  1491. X    prp = plp->props;
  1492. X    for (prp1=0; prp; prp=prp->prnext) {
  1493. X        if (!strcmp(prp->prname,token(prop->obstr))) {
  1494. X            if (prp1)
  1495. X                prp1->prnext = prp->prnext;
  1496. X            else
  1497. X                plp->props = prp->prnext;
  1498. X            JFREE(prp->prname);
  1499. X            lfree(prp->prvalue);
  1500. X            JFREE(prp);
  1501. X            break;
  1502. X        }
  1503. X        prp1 = prp;
  1504. X    }
  1505. X    if (prp == 0) {
  1506. X        pf1("%p has no %p property.\n",name,prop);
  1507. X        errhand();
  1508. X    }
  1509. X    mfree(name);
  1510. X    mfree(prop);
  1511. X}
  1512. X
  1513. Xstruct object *gprop(name,prop)
  1514. Xstruct object *name,*prop;
  1515. X{
  1516. X    register struct proplist *plp;
  1517. X    register struct property *prp,*prp1;
  1518. X
  1519. X    if (!stringp(name)) ungood("Gprop",name);
  1520. X    if (!stringp(prop)) ungood("Gprop",prop);
  1521. X    if ((plp=findplist(token(name->obstr)))==0) {
  1522. X        mfree(name);
  1523. X        mfree(prop);
  1524. X        return(0);
  1525. X    }
  1526. X    prp = plp->props;
  1527. X    if (prp1 = findprop(prp,token(prop->obstr))) {
  1528. X        mfree(name);
  1529. X        mfree(prop);
  1530. X        return(localize(prp1->prvalue));
  1531. X    } else {
  1532. X        mfree(name);
  1533. X        mfree(prop);
  1534. X        return(0);
  1535. X    }
  1536. X}
  1537. X
  1538. Xpps() {
  1539. X    register struct proplist *plp;
  1540. X    register struct property *prp;
  1541. X    register char *name;
  1542. X
  1543. X    for (plp=allprops; plp; plp=plp->plnext) {
  1544. X        name = plp->plname;
  1545. X        for (prp=plp->props; prp; prp=prp->prnext) {
  1546. X            pf1("%s's %s is %p\n",name,prp->prname,prp->prvalue);
  1547. X        }
  1548. X    }
  1549. X}
  1550. X
  1551. Xstruct object *plist(name)
  1552. Xstruct object *name;
  1553. X{
  1554. X    register struct proplist *plp;
  1555. X    register struct property *prp;
  1556. X    register struct object *tail;
  1557. X    struct object *head;
  1558. X
  1559. X    if (!stringp(name)) ungood("Plist",name);
  1560. X    if ((plp=findplist(token(name->obstr)))==0) {
  1561. X        mfree(name);
  1562. X        return(0);
  1563. X    }
  1564. X    if ((prp = plp->props)==0) {
  1565. X        mfree(name);
  1566. X        return(0);
  1567. X    }
  1568. X    head = tail = globcons(0,0);
  1569. X    for (; prp; prp=prp->prnext) {
  1570. X        tail->obcar = globcopy(objcpstr(prp->prname));
  1571. X        tail->obcdr = globcopy(globcons(0,0));
  1572. X        tail = tail->obcdr;
  1573. X        tail->obcar = globcopy(prp->prvalue);
  1574. X        if (prp->prnext) tail->obcdr = globcopy(globcons(0,0));
  1575. X        else tail->obcdr = 0;
  1576. X        tail = tail->obcdr;
  1577. X    }
  1578. X    mfree(name);
  1579. X    return(localize(head));
  1580. X}
  1581. X
  1582. X#endif
  1583. X
  1584. END_OF_proplist.c
  1585. if test 3698 -ne `wc -c <proplist.c`; then
  1586.     echo shar: \"proplist.c\" unpacked with wrong size!
  1587. fi
  1588. # end of overwriting check
  1589. fi
  1590. if test -f splithelp.c -a "${1}" != "-c" ; then 
  1591.   echo shar: Will not over-write existing file \"splithelp.c\"
  1592. else
  1593. echo shar: Extracting \"splithelp.c\" \(1772 characters\)
  1594. sed "s/^X//" >splithelp.c <<'END_OF_splithelp.c'
  1595. X
  1596. X/*
  1597. X * splithelp.c -- turn nroff output of logoman into help files.
  1598. X *
  1599. X * For this to work, there must be no em dashes in the logoman source
  1600. X * except on lines which name primitives.  Also, the file which is
  1601. X * nroffed isn't the actual logoman, but a version which has been edited
  1602. X * by the makehelp shell script (which also runs this program) to change
  1603. X * what's where.  The algorithm is that a primitive description starts
  1604. X * with a line with a dash (represented here as a tilde) and continues
  1605. X * until a line with a nonspace, nonempty first character.
  1606. X */
  1607. X
  1608. X#include <stdio.h>
  1609. X
  1610. Xint memb(ch,str)
  1611. Xregister char ch;
  1612. Xregister char *str;
  1613. X{
  1614. X    register char ch1;
  1615. X
  1616. X    while (ch1 = *str++)
  1617. X        if (ch == ch1)
  1618. X            return(1);
  1619. X    return(0);
  1620. X}
  1621. X
  1622. Xmain(argc,argv)
  1623. Xchar **argv;
  1624. X{
  1625. X    FILE *ip, *op;
  1626. X    int writing = 0;    /* nonzero when writing a file */
  1627. X    int empty = 0;        /* nonzero after an empty line */
  1628. X    register char *cp;
  1629. X    char line[100];
  1630. X    char primitive[30];
  1631. X
  1632. X    if ((ip = fopen(argv[1],"r")) == NULL) {
  1633. X        printf("Splithelp: Can't read input.\n");
  1634. X        exit(1);
  1635. X    }
  1636. X
  1637. X    while (fgets(line,100,ip)) {
  1638. X        if (memb('~',line)) {    /* start new file */
  1639. X            empty = 0;
  1640. X            if (writing)
  1641. X                fclose(op);
  1642. X            sscanf(line,"%s",primitive);
  1643. X            if (strlen(primitive) > 9) {
  1644. X                for (cp = line; *cp && *cp!=':'; cp++) ;
  1645. X                sscanf(cp+2,"%s",primitive);
  1646. X            }
  1647. X            if ((op = fopen(primitive,"w")) == NULL) {
  1648. X                printf("Splithelp: Can't write output.\n");
  1649. X                exit(1);
  1650. X            }
  1651. X            for (cp = line; *cp != '~'; cp++) ;
  1652. X            *cp++ = '-';
  1653. X            *cp = '-';
  1654. X            fprintf(op,"%s",line);
  1655. X            writing++;
  1656. X        } else if (line[0] == '\n') {
  1657. X            empty++;
  1658. X        } else if (writing && line[0]==' ') {
  1659. X            if (empty) fprintf(op,"\n");
  1660. X            empty = 0;
  1661. X            fprintf(op,"%s",line);
  1662. X        } else if (writing) {
  1663. X            fclose(op);
  1664. X            writing = 0;
  1665. X        }
  1666. X    }
  1667. X    if (writing) fclose(op);
  1668. X}
  1669. X
  1670. END_OF_splithelp.c
  1671. if test 1772 -ne `wc -c <splithelp.c`; then
  1672.     echo shar: \"splithelp.c\" unpacked with wrong size!
  1673. fi
  1674. # end of overwriting check
  1675. fi
  1676. if test -f sun.i -a "${1}" != "-c" ; then 
  1677.   echo shar: Will not over-write existing file \"sun.i\"
  1678. else
  1679. echo shar: Extracting \"sun.i\" \(1858 characters\)
  1680. sed "s/^X//" >sun.i <<'END_OF_sun.i'
  1681. X
  1682. X/* Include file for turtle.c for Sun Microsystems workstation */
  1683. X
  1684. X#include <gfx.h>
  1685. X/* If we are on a Sun, Logo must be loaded -lgfx */
  1686. X
  1687. Xint sunturt(),sunfrom(),sunto(),suninit(),sunstate();
  1688. Xstruct display sun ={0.0,0.0,0.0,-1000.0,1000.0,-1000.0,1000.0,1.0,0,
  1689. X    "","","","",sunturt,sunfrom,sunto,nullfn,suninit,nullfn,
  1690. X    nullfn,nullfn,nullfn,sunstate};
  1691. X
  1692. XNUMBER sunoldx,sunoldy;
  1693. X
  1694. Xtransline(type,fromx,fromy,tox,toy) {
  1695. X    line(type,fromx+screen.w/2,screen.h/2-fromy,tox+screen.w/2,
  1696. X            screen.h/2-toy);
  1697. X}
  1698. X
  1699. Xsunturt(hide)
  1700. Xint hide;    /* nonzero to erase turtle */
  1701. X{
  1702. X    double newx,newy,oldx,oldy,angle;
  1703. X
  1704. X    angle = (mydpy->turth-90.0)*3.141592654/180.0;
  1705. X    oldx = mydpy->turtx + 15.0*sin(angle);
  1706. X    oldy = mydpy->turty + 15.0*cos(angle);
  1707. X    angle = mydpy->turth*3.141592654/180.0;
  1708. X    newx = mydpy->turtx + 15.0*sin(angle);
  1709. X    newy = mydpy->turty + 15.0*cos(angle);
  1710. X    transline(GXinvert,(int)oldx,(int)(yscrunch*oldy),
  1711. X        (int)newx,(int)(yscrunch*newy));
  1712. X    oldx = newx;
  1713. X    oldy = newy;
  1714. X    angle = (mydpy->turth+90.0)*3.141592654/180.0;
  1715. X    newx = mydpy->turtx + 15.0*sin(angle);
  1716. X    newy = mydpy->turty + 15.0*cos(angle);
  1717. X    transline(GXinvert,(int)oldx,(int)(yscrunch*oldy),
  1718. X        (int)newx,(int)(yscrunch*newy));
  1719. X    oldx = newx;
  1720. X    oldy = newy;
  1721. X    angle = (mydpy->turth-90.0)*3.141592654/180.0;
  1722. X    newx = mydpy->turtx + 15.0*sin(angle);
  1723. X    newy = mydpy->turty + 15.0*cos(angle);
  1724. X    transline(GXinvert,(int)oldx,(int)(yscrunch*oldy),
  1725. X        (int)newx,(int)(yscrunch*newy));
  1726. X}
  1727. X
  1728. Xsuninit() {
  1729. X    initscreen();
  1730. X    drasterop(GXset,0,0,SCREEN,1024,1024);
  1731. X}
  1732. X
  1733. Xsunfrom(x,y)
  1734. XNUMBER x,y;
  1735. X{
  1736. X    sunoldx = x;
  1737. X    sunoldy = y;
  1738. X}
  1739. X
  1740. Xsunto(x,y)
  1741. XNUMBER x,y;
  1742. X{
  1743. X    static int sunpens[] = {GXclear,GXset,GXinvert};
  1744. X    /* NOTE should be set,clear but it works this way, why??? */
  1745. X
  1746. X    transline((sunpens[penerase],
  1747. X        (int)sunoldx,(int)sunoldy,(int)x,(int)y);
  1748. X}
  1749. X
  1750. Xsunstate(which) {
  1751. X    if (which == 'c' || which == 'w')
  1752. X        drasterop(GXset,0,0,SCREEN,1024,1024);
  1753. X}
  1754. X
  1755. END_OF_sun.i
  1756. if test 1858 -ne `wc -c <sun.i`; then
  1757.     echo shar: \"sun.i\" unpacked with wrong size!
  1758. fi
  1759. # end of overwriting check
  1760. fi
  1761. if test -f tek.i -a "${1}" != "-c" ; then 
  1762.   echo shar: Will not over-write existing file \"tek.i\"
  1763. else
  1764. echo shar: Extracting \"tek.i\" \(835 characters\)
  1765. sed "s/^X//" >tek.i <<'END_OF_tek.i'
  1766. X
  1767. X/* Include file for turtle.c for TEK */
  1768. X
  1769. Xint tekfrom(),tekto(),tekin(),tekout(),tekstate();
  1770. Xstruct display tek ={0.0,0.0,0.0,-512.0,511.0,-390.0,389.0,1.0,0,
  1771. X    "","\032\035\033\014\030","","\032\035\033\014\030",
  1772. X    nullfn,tekfrom,tekto,nullfn,tekin,tekout,nullfn,
  1773. X    nullfn,nullfn,tekstate};
  1774. X
  1775. Xtekfrom(x,y)
  1776. Xdouble x,y;
  1777. X{
  1778. X    printf("\035");
  1779. X    plotpos((int)x,(int)y);
  1780. X}
  1781. X
  1782. Xtekto(x,y)
  1783. Xdouble x,y;
  1784. X{
  1785. X    plotpos((int)x,(int)y);
  1786. X    printf("\035\067\177\040\100\037\030");
  1787. X}
  1788. X
  1789. Xtekin() {
  1790. X    shown = 0;
  1791. X    system("stty -lcase");
  1792. X}
  1793. X
  1794. Xtekout() {
  1795. X    system("stty lcase");
  1796. X}
  1797. X
  1798. Xtekstate(which) {
  1799. X    switch(which) {
  1800. X        case 'R':
  1801. X            printf("Tek can't penreverse, setting pendown\n.");
  1802. X            penerase = 0;
  1803. X            return;
  1804. X        case 'E':
  1805. X            printf("Tek can't penerase, setting pendown.\n");
  1806. X            penerase = 0;
  1807. X            return;
  1808. X        case 'S':
  1809. X            printf("Tek can't showturtle.\n");
  1810. X            shown = 0;
  1811. X    }
  1812. X}
  1813. X
  1814. END_OF_tek.i
  1815. if test 835 -ne `wc -c <tek.i`; then
  1816.     echo shar: \"tek.i\" unpacked with wrong size!
  1817. fi
  1818. # end of overwriting check
  1819. fi
  1820. if test -f unix.c -a "${1}" != "-c" ; then 
  1821.   echo shar: Will not over-write existing file \"unix.c\"
  1822. else
  1823. echo shar: Extracting \"unix.c\" \(3955 characters\)
  1824. sed "s/^X//" >unix.c <<'END_OF_unix.c'
  1825. X
  1826. X#include "logo.h"
  1827. X#include <setjmp.h>
  1828. X#include <signal.h>
  1829. X
  1830. Xchar *ostring;
  1831. XFILE *ofile;
  1832. X#ifdef DEBUG
  1833. Xint memtrace=0;
  1834. Xextern int yydebug;
  1835. X#endif
  1836. X
  1837. X#ifdef PAUSE
  1838. X
  1839. Xint errpause=0;
  1840. X
  1841. Xseterrpause() {
  1842. X    errpause++;
  1843. X}
  1844. X
  1845. Xclrerrpause() {
  1846. X    errpause = 0;
  1847. X}
  1848. X#endif
  1849. X
  1850. Xstruct object *stringform(arg)
  1851. Xregister struct object *arg;
  1852. X{
  1853. X    char str[IBUFSIZ];
  1854. X    struct object *bigsave();
  1855. X#ifdef DEBUG
  1856. X    int omemt;
  1857. X
  1858. X    omemt = memtrace;
  1859. X    memtrace = 0;
  1860. X#endif
  1861. X    ostring = &str[0];
  1862. X    str[0] = '\0';    /* in case of empty */
  1863. X    tyobj(arg);
  1864. X    ostring = 0;
  1865. X#ifdef DEBUG
  1866. X    memtrace = omemt;
  1867. X#endif
  1868. X    return (bigsave(str));
  1869. X}
  1870. X
  1871. Xputch(ch)
  1872. Xregister ch;
  1873. X{
  1874. X    if (ch != -1) {
  1875. X        putchar(ch);
  1876. X    }
  1877. X    return (ch);
  1878. X}
  1879. X
  1880. X/* VARARGS */
  1881. Xchar *cpystr(to,f1,f2,f3,f4,f5,f6,f7,f8,f9,f0)
  1882. Xregister char *to;
  1883. Xchar *f1,*f2,*f3,*f4,*f5,*f6,*f7,*f8,*f9,*f0;
  1884. X{
  1885. X    char *out,**in;
  1886. X
  1887. X    out = to;
  1888. X    in = &f1;
  1889. X    while (*in) {
  1890. X        strcpy(out,*in);
  1891. X        out += strlen(*in);
  1892. X        in++;
  1893. X    }
  1894. X    return (out);
  1895. X}
  1896. X
  1897. Xjmp_buf env;
  1898. X
  1899. Xextern errrec();
  1900. X
  1901. Xint floflo() {
  1902. X    signal(SIGFPE,floflo);
  1903. X    puts("Arithmetic overflow.");
  1904. X    errhand();
  1905. X}
  1906. X
  1907. Xenter()
  1908. X{
  1909. X    register x;
  1910. X
  1911. X    if (x=setjmp(env)) {
  1912. X        return(x);
  1913. X    } else {
  1914. X        onintr(errrec,1);
  1915. X        signal(SIGFPE,floflo);
  1916. X        return (yyparse());
  1917. X    }
  1918. X}
  1919. X
  1920. Xleave(val)
  1921. X{
  1922. X    putchar('\n');
  1923. X    longjmp(env,val);
  1924. X}
  1925. X
  1926. Xint sigarg;
  1927. Xint (*intfun)();
  1928. Xextern sigquit();
  1929. X#ifdef PAUSE
  1930. Xint pausesig = PAUSESIG;
  1931. Xint othersig = OTHERSIG;
  1932. Xint psigflag = 0;
  1933. X
  1934. Xsigpaws() {    /* User signals a pause request */
  1935. X    signal(pausesig,sigpaws);
  1936. X    psigflag++;
  1937. X}
  1938. X#endif
  1939. X
  1940. Xonintr(inttf,val)
  1941. Xregister int (*inttf)(),val;
  1942. X{
  1943. X    sigarg = val;
  1944. X#ifdef PAUSE
  1945. X    signal(othersig,sigquit);
  1946. X    signal(pausesig,sigpaws);
  1947. X#else
  1948. X    signal(SIGINT,sigquit);
  1949. X    signal(SIGQUIT,sigquit);
  1950. X#endif
  1951. X    intfun = inttf;
  1952. X}
  1953. X
  1954. X#ifdef DEBUG
  1955. Xint deb_quit=0;
  1956. X#endif
  1957. X
  1958. Xsigquit()
  1959. X{
  1960. X#ifdef DEBUG
  1961. X    if(deb_quit) abort();
  1962. X#endif
  1963. X    alarm(0);
  1964. X#ifdef PAUSE
  1965. X    signal(othersig,sigquit);
  1966. X#else
  1967. X    signal(SIGINT,sigquit);
  1968. X    signal(SIGQUIT,sigquit);
  1969. X#endif
  1970. X    (*intfun)(sigarg);
  1971. X}
  1972. X
  1973. X#ifdef DEBUG
  1974. Xsetdebquit() {
  1975. X    deb_quit++;
  1976. X}
  1977. X
  1978. Xsetmemtrace() {
  1979. X    memtrace++;
  1980. X}
  1981. X
  1982. Xsetyaccdebug() {
  1983. X    yydebug++;
  1984. X}
  1985. X#endif
  1986. X
  1987. X#ifdef PAUSE
  1988. Xsetipause() {
  1989. X    pausesig = SIGINT;
  1990. X    othersig = SIGQUIT;
  1991. X}
  1992. X
  1993. Xsetqpause() {
  1994. X    pausesig = SIGQUIT;
  1995. X    othersig = SIGINT;
  1996. X}
  1997. X#endif
  1998. X
  1999. Xputc1(cha)
  2000. Xregister cha;
  2001. X{
  2002. X    if(ostring)
  2003. X    {
  2004. X        *ostring++=cha;
  2005. X        *ostring=0;
  2006. X    }
  2007. X    else if(ofile)fputc(cha,ofile);
  2008. X    else putchar(cha);
  2009. X}
  2010. Xsputs(str)
  2011. Xregister char *str;
  2012. X{
  2013. X    register char c;
  2014. X
  2015. X    if(ofile)
  2016. X        while (c = *str++) fputc(c&0177,ofile);
  2017. X    else if(ostring){
  2018. X        while (c = *str++) {
  2019. X            if (c & 0200) *ostring++ = '\\';
  2020. X            *ostring++ = c & 0177 ;
  2021. X        }
  2022. X        *ostring = '\0';
  2023. X    }
  2024. X    else
  2025. X        while (c = *str++) fputc(c&0177,stdout);
  2026. X}
  2027. Xnputs(str)
  2028. Xregister char *str;
  2029. X{
  2030. X    register char c;
  2031. X
  2032. X    while (c = *str++) fputc(c,stdout);
  2033. X}
  2034. X
  2035. X/*VARARGS*/
  2036. Xpf1(str,a1,a2,a3,a4)
  2037. Xregister char *str;
  2038. Xstruct object *a1,*a2,*a3,*a4;
  2039. X{
  2040. X    register c;
  2041. X    register struct object **arg;
  2042. X#ifdef DEBUG
  2043. X    int omemt;
  2044. X
  2045. X    omemt = memtrace;
  2046. X    memtrace = 0;
  2047. X#endif
  2048. X    arg= &a1;
  2049. X    while(c= *str++){
  2050. X        if(c=='%'){
  2051. X            c= *str++;
  2052. X            if(c=='d'){
  2053. X                if(ostring){
  2054. X                    sprintf(ostring,"%d",(int)(*arg++));
  2055. X                    ostring+=strlen(ostring);
  2056. X                }else if(ofile)
  2057. X                    fprintf(ofile,"%d",(int)(*arg++));
  2058. X                else printf("%d",(int)(*arg++));
  2059. X            } else if(c=='o'){
  2060. X                if(ostring){
  2061. X                    sprintf(ostring,"%o",(int)(*arg++));
  2062. X                    ostring+=strlen(ostring);
  2063. X                }else if(ofile)
  2064. X                    fprintf(ofile,"%o",(int)(*arg++));
  2065. X                else printf("%o",(int)(*arg++));
  2066. X            } else if(c=='s'){
  2067. X                if(ostring){
  2068. X                    strcpy(ostring,(char *)(*arg++));
  2069. X                    ostring += strlen(ostring);
  2070. X                } else if (ofile)
  2071. X                    fprintf(ofile,"%s",(char *)(*arg++));
  2072. X                else printf("%s",(char *)(*arg++));
  2073. X            } else if(c=='l'){
  2074. X                if(!listp(*arg)){
  2075. X                    if(emptyp(*arg)) sputs("empty");
  2076. X                    else if(stringp(*arg) && !nump(*arg))
  2077. X                        putc1('\"');
  2078. X                }
  2079. X                fty1(*arg++);
  2080. X            } else if(c=='p') {
  2081. X                if(!stringp(*arg)) {
  2082. X                    *arg=stringform(*arg);
  2083. X                    sputs((*arg)->obstr);
  2084. X                    mfree(*arg);
  2085. X                } else sputs((*arg)->obstr);
  2086. X                arg++;
  2087. X            }
  2088. X            else putc1(c);
  2089. X        }
  2090. X        else putc1(c);
  2091. X    }
  2092. X#ifdef DEBUG
  2093. X    memtrace = omemt;
  2094. X#endif
  2095. X}
  2096. X
  2097. END_OF_unix.c
  2098. if test 3955 -ne `wc -c <unix.c`; then
  2099.     echo shar: \"unix.c\" unpacked with wrong size!
  2100. fi
  2101. # end of overwriting check
  2102. fi
  2103. if test -f zerr.c -a "${1}" != "-c" ; then 
  2104.   echo shar: Will not over-write existing file \"zerr.c\"
  2105. else
  2106. echo shar: Extracting \"zerr.c\" \(2650 characters\)
  2107. sed "s/^X//" >zerr.c <<'END_OF_zerr.c'
  2108. X
  2109. X/*    This file contains most of the error messages for LOGO, along with
  2110. X*    the functions that print the various messages.
  2111. X*
  2112. X*    Copyright (C) 1979, The Children's Museum, Boston, Mass.
  2113. X*    Written by Douglas B. Klunder.
  2114. X*/
  2115. X#include "logo.h"
  2116. Xextern int yychar,errtold;
  2117. Xextern short yyerrflag;
  2118. Xextern char *ibufptr;
  2119. Xextern char charib;
  2120. Xextern int letflag;
  2121. Xextern struct lexstruct keywords[];
  2122. X
  2123. Xaerr2(etype,arg,op)    /* This handles an unknown second input to infix
  2124. X            *  arithmetic operations.  */
  2125. Xregister char *etype,*arg;
  2126. Xchar op;
  2127. X{
  2128. X    if (!errtold) {
  2129. X        nputs(etype);
  2130. X        pf1(" of %l and what?\n",arg);
  2131. X        putchar(op);
  2132. X        puts(" must have two numbers for inputs.");
  2133. X        errtold++;
  2134. X    }
  2135. X}
  2136. X
  2137. Xnotenf(op)
  2138. Xregister op;
  2139. X{
  2140. X    if (!errtold) {
  2141. X        pf1("Not enough inputs to %s.\n",keywords[op].word);
  2142. X        errtold++;
  2143. X    }
  2144. X}
  2145. X
  2146. X
  2147. Xunerr(c)    /* Unknown following unary - or +. */
  2148. Xregister char c;
  2149. X{
  2150. X    if (!errtold) {
  2151. X        putchar(c);
  2152. X        puts(" what?");
  2153. X        putchar(c);
  2154. X        pf1(" must be followed by a number.\n");
  2155. X        errtold++;
  2156. X    }
  2157. X}
  2158. Xinferr(arg,op)    /* Incorrect second input to infix operator. */
  2159. Xregister char *arg;
  2160. Xregister op;
  2161. X{
  2162. X    if (!errtold) {
  2163. X        switch(op) {
  2164. X            case '+': aerr2("sum",arg,'+');break;
  2165. X            case '-': aerr2("difference",arg,'-');break;
  2166. X            case '*': aerr2("product",arg,'*');break;
  2167. X            case '/': aerr2("quotient",arg,'/');break;
  2168. X            case '\\': aerr2("remainder",arg,'\\');break;
  2169. X            case '<': aerr2("lessp",arg,'<');break;
  2170. X            case '>': aerr2("greaterp",arg,'>');break;
  2171. X            case '^': aerr2("pow",arg,'^');break;
  2172. X            case '=':
  2173. X                pf1("equalp of %l and what?\n",arg);
  2174. X                puts("= takes two inputs.");
  2175. X        }
  2176. X        errtold++;
  2177. X    }
  2178. X}
  2179. Xop2er1(op,arg)    /* No second input to two-input operation. */
  2180. Xregister op;
  2181. Xregister char *arg;
  2182. X{
  2183. X    if (!errtold) {
  2184. X        nputs(keywords[op].word);
  2185. X        pf1(" of %l and what?\n",arg);
  2186. X        nputs(keywords[op].word);
  2187. X        puts(" takes two inputs.");
  2188. X        errtold++;
  2189. X    }
  2190. X}
  2191. Xterr()    /* Incorrect title. */
  2192. X{
  2193. X    puts("That doesn't look like a title to me.");
  2194. X    errclear();
  2195. X}
  2196. Xyyerror(str)
  2197. Xregister char *str;
  2198. X{
  2199. X    if ( *str == 'y') {
  2200. X        puts("Too many levels of recursion.");
  2201. X        errtold++;
  2202. X    }
  2203. X/* yacc has two messages.  We ignore "syntax error" which has been dealt with
  2204. Xdownlevel already, and on "yacc stack overflow" we must clear out the tables.
  2205. X */
  2206. X}
  2207. X
  2208. Xlogoyerror()    /* General unknown command. */
  2209. X{
  2210. X    if (yychar==1) return;
  2211. X    puts("I don't understand that.");
  2212. X    puts("Please submit a Logo bug report, telling what you typed,");
  2213. X    puts(" and asking for a more specific error message.");
  2214. X}
  2215. Xerrclear()    /* clear error status in editor. */
  2216. X{
  2217. X    ibufptr=NULL;
  2218. X    yychar= -1;
  2219. X    yyerrflag=0;
  2220. X    letflag=0;
  2221. X}
  2222. Xungood(name,val)
  2223. Xregister char *name,*val;
  2224. X{
  2225. X    nputs(name);
  2226. X    pf1(" doesn't like %l as input.\n",val);
  2227. X    errhand();
  2228. X}
  2229. X
  2230. END_OF_zerr.c
  2231. if test 2650 -ne `wc -c <zerr.c`; then
  2232.     echo shar: \"zerr.c\" unpacked with wrong size!
  2233. fi
  2234. # end of overwriting check
  2235. fi
  2236. echo shar: End of archive 1 \(of 6\).
  2237. cp /dev/null ark1isdone
  2238. MISSING=""
  2239. for I in 1 2 3 4 5 6 ; do
  2240.     if test ! -f ark${I}isdone ; then
  2241.     MISSING="${MISSING} ${I}"
  2242.     fi
  2243. done
  2244. if test "${MISSING}" = "" ; then
  2245.     echo You have unpacked all 6 archives.
  2246.     echo "Now see the README"
  2247.     rm -f ark[1-9]isdone
  2248. else
  2249.     echo You still need to unpack the following archives:
  2250.     echo "        " ${MISSING}
  2251. fi
  2252. ##  End of shell archive.
  2253. exit 0
  2254.